package demo2.assignment3;

import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author Leon(赵亮)
 * @version 1.0.0
 * 10 Sep 2021
 * this is the old system user info class
 */
public class UserInfo implements IUserInfo {

    private String number;
    private final String id;
    private String homeAddress;
    private String name;
    private Map<String, String> teles;

    private static final AtomicInteger atomicInteger = new AtomicInteger();


    public UserInfo() {
        this.id = String.valueOf(atomicInteger.incrementAndGet());
    }

    @Override
    public String getNumber() {
        return number;
    }

    @Override
    public String getId() {
        return id;
    }

    @Override
    public String getUserHomeAddress() {
        return homeAddress;
    }

    @Override
    public Map<String, String> getUserTeles() {
        return teles;
    }

    @Override
    public String getName() {
        return name;
    }

    public void setNumber(int number) {
        this.number = String.valueOf(number);
    }

    public void setHomeAddress(String homeAddress) {
        this.homeAddress = homeAddress;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setTeles(Map<String, String> teles) {
        this.teles = teles;
    }

    @Override
    public String toString() {
        return "UserInfo{" +
                "number='" + number + '\'' +
                ", id='" + id + '\'' +
                ", homeAddress='" + homeAddress + '\'' +
                ", name='" + name + '\'' +
                ", teles=" + teles +
                '}';
    }
}
